# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan De Groot <jgc@archlinux.org>

pkgname=gnome-keyring
pkgver=40.0
pkgrel=1
epoch=1
pkgdesc="Stores passwords and encryption keys"
url="https://wiki.gnome.org/Projects/GnomeKeyring"
arch=(x86_64)
license=(GPL LGPL)
depends=(gcr libcap-ng pam openssh)
makedepends=(git docbook-xsl python)
provides=(org.freedesktop.secrets)
groups=(gnome)
install=gnome-keyring.install
_commit=a9c867468b86719afc9fb62479dc5c48244f5926  # tags/40.0^0
source=("git+https://gitlab.gnome.org/GNOME/gnome-keyring.git#commit=$_commit"
        add-cinnamon.diff)
sha256sums=('SKIP'
            'd05210f5b0a7d4b22c0dff2854854af2eb5708aa2b296095e070dca68e9f815a')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname

  # Autolaunch in Cinnamon
  git apply -3 ../add-cinnamon.diff

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib \
    --with-pam-dir=/usr/lib/security \
    --disable-static \
    --disable-schemas-compile
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd $pkgname
  # Secure memory tests fail
  dbus-run-session make -k check || :
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}
